<template>
    <div class="child2">
        这是child2组件内容
        <h1>这是child2---{{$store.state.count}}</h1>

        <el-button @click='child2Add'>自增</el-button>
    </div>
</template>
<script>
export default {
 
    data() {
        return{}
    },
    methods:{
        child2Add(){
              this.$store.commit('addCount')
        }
    }
}
</script>

<style lang="scss" scoped>
.child2{
    width: 300px;
    height: 200px;
    border: 2px solid #ddd;
}
</style>>

